package com.acme.task2;

/**
 * In this class finalize() method is overriden
 * @author Anton Kotov
 */
public class Foo {
	/**
	 * number of iteration
	 */
	private int iterationNo = 0;

	/**
	 * Constructor with argument
	 * 
	 * @param iterationNo
	 *            number of iteration
	 */
	public Foo(int iterationNo) {
		this.iterationNo = iterationNo;
	}

	/**
	 * finalize() method, which prints number of iteration
	 */
	@Override
	protected void finalize() throws Throwable {
		System.out.format("finalize() was called on %d iteration%n",
				iterationNo);
		super.finalize();
	}
}
